package net.springmvc17_18.controller;

import net.springmvc17_18.entity.Stu;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("user")
public class UserRestFulController {

    // 查询
    @GetMapping
    public String selectAll(@RequestParam String pageNo,
                            @RequestParam String pageSize) {
        System.out.println(pageNo+" "+pageSize);
        return "selectAll";
    }

    // 详情
    @GetMapping("/{id}")
    public String selectOne(@PathVariable String id) {
        System.out.println(id);
        return "selectOne";
    }

    // 新增
    @PostMapping
    public String insert(@RequestBody Stu user) {
        System.out.println(user);
        return "insert";
    }
    // 更新
    @PutMapping
    public String update(@RequestBody Stu user) {
        System.out.println(user);
        return "update";
    }

    @DeleteMapping("/{id}")
    public String delete(@PathVariable String id) {
        System.out.println(id);
        return "delete";
    }

}
